<?php
$xtpl = new XTemplate("modules/home/testimonials_task.htm");
$UPLOAD = new UPLOAD();
//--
//--
$cid=intval($_GET['cid']);
//--
//--
$POST = $_POST;
if($_POST[type] == 'NEW'){	
	//--
	$POST['name']=$POST['name'];
    $POST['id_lang']=$_SESSION['ID_LANG_ADM'];
	$DB->DBInsert('testimonial', $POST);
	//--
	$GUI->redir("?mod=home&act=testimonials&cid=".$cid."");
}
//--
//--
//--
//--
elseif($_POST[type] == 'EDIT'){
	$POST['status']=$_POST['status'];
	//--
	$POST['name']=addslashes($POST['name']);
	$DB->DBUpdate('testimonial', $POST, "WHERE id = '".$_POST['id']."'");
	$GUI->redir("?mod=home&act=testimonials");
}
//--
//--
if($_GET[id] != ''){
	$row = $DB->FetchData('testimonial','*',"WHERE id='".$_GET['id']."'");
	$row[headline]=$row[headline];
	$row[type] = 'EDIT';
	if($row['status']=='1'){
 		$row['status']="checked";
	}		
}else{
	$row[type] = 'NEW';
	$row['status']="checked";
	//--
	
}
//--
$_FCKeditor = new FCKeditor("description");
$_FCKeditor->BasePath = $siteFCKeditorPath;
$_FCKeditor->Width = '95%';
$_FCKeditor->Height = '400';
$_FCKeditor->Value =stripslashes($row['description']);
//--
$xtpl->assign("write",$row);
//--
//--
//--
//--
//--
$waypathlink = '&raquo;&nbsp;<a href="?mod=home&act=testimonials" class="waypath">Testimonials Management</a>:&nbsp;'.$row['type'];
$xtpl_main->assign("waypathlink",$waypathlink);
//--
//--
//--
//--
//--
//--
$save_button = $GUI->button_ren("Save","javascript: doSavetestimonials();");
$xtpl->assign("save_button",$save_button);
//--
$cancel_button = $GUI->button_ren("Cancel","javascript: add('?mod=home&act=testimonials&cid=".$cid."')");
$xtpl->assign("cancel_button",$cancel_button);
//--
//--
//--
//--
//--


?>